import request from '@/config/axios'

export interface LinkVO {
  id: number
  siteId: number
  name: string
  linkUrl: string
  linkLogoUrl: string
  linkType: number
  sort: number
}

// 查询友情链接列表
export const getLinkPage = async (params) => {
  return await request.get({ url: '/cms/link/page', params })
}

// 查询友情链接详情
export const getLink = async (id: number) => {
  return await request.get({ url: '/cms/link/get?id=' + id })
}

// 新增友情链接
export const createLink = async (data: LinkVO) => {
  return await request.post({ url: '/cms/link/create', data })
}

// 修改友情链接
export const updateLink = async (data: LinkVO) => {
  return await request.put({ url: '/cms/link/update', data })
}

// 删除友情链接
export const deleteLink = async (id: number) => {
  return await request.delete({ url: '/cms/link/delete?id=' + id })
}

// 导出友情链接 Excel
export const exportLinkApi = async (params) => {
  return await request.download({ url: '/cms/link/export-excel', params })
}
